package com.servicesManagement.model;
// Generated Dec 13, 2014 11:53:18 AM by Hibernate Tools 3.2.1.GA

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * LineOfBusiness generated by hbm2java
 */
@Entity
@Table(name = "LINE_OF_BUSINESS", schema = "SANKAR")
public class LineOfBusiness implements java.io.Serializable {

    private Long lobId;
    private BigDecimal changedByUserId;
    private Date changedDate;
    private BigDecimal createdByUserId;
    private Date createdDate;
    private String description;
    private LineOfBusiness parentLineOfBusinesses;
    private Set<ServiceLine> serviceLine = new HashSet<ServiceLine>();

    public LineOfBusiness() {
    }

    public LineOfBusiness(Long lobId) {
        this.lobId = lobId;
    }

    public LineOfBusiness(Long lobId, BigDecimal changedByUserId, Date changedDate, BigDecimal createdByUserId, Date createdDate, String description, LineOfBusiness parentLineOfBusinesses, Set<ServiceLine> serviceLine) {
        this.lobId = lobId;
        this.changedByUserId = changedByUserId;
        this.changedDate = changedDate;
        this.createdByUserId = createdByUserId;
        this.createdDate = createdDate;
        this.description = description;
        this.parentLineOfBusinesses = parentLineOfBusinesses;
        this.serviceLine = serviceLine;
    }

    /**
     *
     * @return
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "LOB_ID", unique = true, nullable = false, scale = 0)
    public Long getLobId() {
        return this.lobId;
    }

    public void setLobId(Long lobId) {
        this.lobId = lobId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PARENT_LOB_ID")
    public LineOfBusiness getParentLineOfBusinesses() {
        return this.parentLineOfBusinesses;
    }

    public void setParentLineOfBusinesses(LineOfBusiness lineOfBusiness) {
        this.parentLineOfBusinesses = lineOfBusiness;
    }

    @Column(name = "CHANGED_BY_USER_ID")
    public BigDecimal getChangedByUserId() {
        return this.changedByUserId;
    }

    public void setChangedByUserId(BigDecimal changedByUserId) {
        this.changedByUserId = changedByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CHANGED_DATE", length = 7)
    public Date getChangedDate() {
        return this.changedDate;
    }

    public void setChangedDate(Date changedDate) {
        this.changedDate = changedDate;
    }

    @Column(name = "CREATED_BY_USER_ID")
    public BigDecimal getCreatedByUserId() {
        return this.createdByUserId;
    }

    public void setCreatedByUserId(BigDecimal createdByUserId) {
        this.createdByUserId = createdByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CREATED_DATE", length = 7)
    public Date getCreatedDate() {
        return this.createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    @Column(name = "DESCRIPTION")
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinTable(name = "SERVICE_LINE_OF_BUSINESS", joinColumns = {
        @JoinColumn(name = "LOB_ID", referencedColumnName = "LOB_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "SERVICE_LINE_ID", referencedColumnName = "SERVICE_LINE_ID")})
    public Set<ServiceLine> getServiceLine() {

        return this.serviceLine;
    }

    public void setServiceLine(Set<ServiceLine> serviceLine) {

        this.serviceLine = serviceLine;
    }
}
